﻿//     Copyright (c) Microsoft Corporation.  All rights reserved.

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using Microsoft.Gateway.Utils;

namespace Gateway.Console
{
    public static class Configuration
    {
        public static bool IsAppInitialized
        {
            get { return AzureUtils.GetConfigSetting("ApplicationInitialized", false); }
            set { AzureUtils.SetConfigSetting("ApplicationInitialized", value); }
        }

        public static int SvcPkgCopyStatusMaxRetries
        {
            get {  return AzureUtils.GetConfigSetting("SvcPkgCopyStatusMaxRetries", 5); }
        }

        public static int SvcPkgCopyStatusSleepPeriod
        {
            get { return AzureUtils.GetConfigSetting("SvcPkgCopyStatusSleepPeriod", 3000); }
        }

        public static string PackageUpdateServiceLocation
        {
            get { return AzureUtils.GetConfigSetting("PackageUpdateServiceLocation", ""); }
        }

        public static string Tenant
        {
            get { return AzureUtils.GetConfigSetting("ida:Tenant", ""); }
            set { AzureUtils.SetConfigSetting("ida:Tenant", value); }
        }

        public static string FederationMetadataLocation
        {
            get { return AzureUtils.GetConfigSetting("ida:FederationMetadataLocation", Microsoft.Gateway.Utils.AzureEnvironment.FederationMetadataCommonLocation); }
        }

        public static string ClientID
        {
            get { return AzureUtils.GetConfigSetting("ida:ClientID", ""); }
            set { AzureUtils.SetConfigSetting("ida:ClientID", value); }
        }

        public static string ClientKey
        {
            get { return AzureUtils.GetConfigSetting("ida:Password", ""); }
            set { AzureUtils.SetConfigSetting("ida:Password", value); }
        }

        public static string ConsoleConnectionString
        {
            get { return ConfigurationManager.ConnectionStrings["ConsoleContext"].ConnectionString; }
        }

        public static bool NoUpdateCheck
        {
            get { return AzureUtils.GetConfigSetting("NoUpdateCheck", false); }
        }

        public static AzureEnvironments AzureEnvironment
        {
            get { return AzureUtils.GetConfigSetting("AzureEnvironment", AzureEnvironments.AzureCloud); }
        }
    }
}